# Contributor: Adrián Arroyo Calle <adrian.arroyocalle@gmail.com>
# Maintainer: Adrián Arroyo Calle <adrian.arroyocalle@gmail.com>
pkgname=scryer-prolog
pkgver=0.9.0
pkgrel=0
pkgdesc="Modern Prolog implementation written in Rust"
url="https://github.com/mthom/scryer-prolog"
# s390x, riscv64: rust
# ppc64le: rust-ring
# 32-bit: unsupported
arch="aarch64 x86_64"
license="BSD-3-Clause"
makedepends="
	cargo
	gmp-dev
	libsodium-dev
	m4
	mpc1-dev
	mpfr-dev
	openssl-dev
	rustfmt
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/mthom/scryer-prolog/archive/refs/tags/v$pkgver.tar.gz"

# system libs
export OPENSSL_NO_VENDOR=1
export CARGO_FEATURE_USE_SYSTEM_LIBS=1
export SODIUM_USE_PKG_CONFIG=1

# optimise size
export CARGO_PROFILE_RELEASE_LTO="true"
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
export CARGO_PROFILE_RELEASE_OPT_LEVEL="s"

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	cargo build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/scryer-prolog -t "$pkgdir"/usr/bin
}

sha512sums="
ef929def6b71f94241b38df576cc6590f79647c9c6fe3d5998dd54f2f5911f18eaef2dccf3fa9a378ed8a82a54ed97b7e00ba3bef6f87b916d8de86c84634a8c  scryer-prolog-0.9.0.tar.gz
"
